Release 10.1A: OpenEdge Development:
Web Services


Invoking a method with a TABLE parameter (RPC/Encoded)

To invoke a method that passes a TABLE parameter, the client application typically must:

This the Progress 4GL prototype for a sample method, staticTT( ), that passes a TABLE parameter:

Progress 4GL prototype that passes a TABLE parameter
/* staticTT.p */ 
DEFINE INPUT-OUTPUT PARAMETER TABLE FOR ttEmp.  

This is the RPC/Encoded WSDL request message for the staticTT( ) method, which has a TABLE parameter, ttEmp. The parameter, ttEmp, is a SOAP array of rows (ttEmpRow) defined in the Types section of the WSDL:

RPC/Encoded WSDL definition for TABLE parameter, ttEmp
<message name="Employee_staticTT"> 
   <part name="ttEmp" type="S2:ArrayOfstaticTT_ttEmpRow"/> 
</message> 

The following are the WSDL row and SOAP array definitions for the TABLE:

TABLE row schema
<complexType name="staticTT_ttEmpRow"> 
   <sequence> 
      <element name="Name" nillable="true" type="xsd:string"/> 
      <element name="Number" nillable="true" type="xsd:int"/> 
   </sequence> 
</complexType> 

TABLE parameter for RPC/Encoded
<complexType name="ArrayOfstaticTT_ttEmpRow"> 
   <complexContent> 
      <restriction base="soapenc:Array"> 
         <attribute ref="soapenc:arrayType" 
            wsdl:arrayType="S2:staticTT_ttEmpRow[]"/> 
      </restriction> 
   </complexContent> 
</complexType> 

As a point of comparison here is the RPC/Literal and Document/Literal representation of this same TABLE parameter definition in WSDL:

TABLE parameter for RPC/Literal and Document/Literal
<complexType name="staticTT_ttEmpParam"> 
  <sequence> 
    <element maxOccurs="unbounded" minOccurs="0" name="ttEmpRow" 
             type="S2:staticTT_ttEmpRow" /> 
  </sequence> 
</complexType> 

This is the declaration for a VB.NET client interface method, staticTT( ), which has a TABLE parameter, ttEmp, passed as the class, staticTT_ttEmpRow:

VB.NET declaration of interface method passing static TEMP-TABLE, ttEmp
Public Class staticTT_ttEmpRow 
    Public Name As String 
    Public Number As Integer 
End Class 
Public Sub staticTT(ByRef ttEmp( ) As staticTT_ttEmpRow) 

The following client code defines a two row array (myTempTable) according to a defined schema (staticTT_ttEmpRow), then defines and creates two rows assigned with values. It then initializes the array (as TABLE, ttEmp) with the two rows and passes it to the staticTT( ) interface method, which passes the TABLE to the Web service:

VB.NET client code passing TABLE, ttEmp, to an interface method
Dim myTempTable(1) as webService.staticTT_ttEmpRow 
Dim myRow1 as webService.staticTT_ttEmpRow =  
                             New webService.staticTT_ttEmpRow( ) 
Dim myRow2 as webService.staticTT_ttEmpRow =  
                             New webService.staticTT_ttEmpRow( ) 
myRow1.Name = "Fred" 
myRow1.Number = 1 
myRow2.Name = "Barney" 
myRow2.Number = 2 
myTempTable(0) = myRow1 
myTempTable(1) = myRow2 
webService.staticTT(myTempTable) 

The following is an RPC/Encoded SOAP message that this call to staticTT( ) might send:

RPC/Encoded SOAP request to pass a TABLE parameter
<?xml version="1.0" encoding="utf-8" ?> 
<soap:Envelope namespaces defined here...> 
  <soap:Header> 
    <q1:EmployeeID id="h_id1" xmlns:q1="urn:EmployeeSrvc:Employee"> 
      <UUID xsi:type="xsd:string">2e62cab6b81150d5:-1380e8e:f27fb934f4: 
      -8000;<Employee|PX-000004|AO>;5REiR9inxXQi4s6ghRWkfg==</UUID> 
    </q1:EmployeeID> 
  </soap:Header> 
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
    <q1:staticTT xmlns:q1="urn:EmployeeSrvc:Employee"> 
      <ttEmp href="#id1" /> 
    </q1:staticTT> 
    <soapenc:Array id="id1" xmlns:q2="urn:EmployeeSrvc:Employee" 
          soapenc:arrayType="q2:staticTT_ttEmpRow[2]"> 
      <Item href="#id2" /> 
      <Item href="#id3" /> 
    </soapenc:Array> 
    <q3:staticTT_ttEmpRow id="id2" xsi:type="q3:staticTT_ttEmpRow" 
          xmlns:q3="urn:EmployeeSrvc:Employee"> 
      <Name xsi:type="xsd:string">Fred</Name> 
      <Number xsi:type="xsd:int">1</Number> 
    </q3:staticTT_ttEmpRow> 
    <q4:staticTT_ttEmpRow id="id3" xsi:type="q4:staticTT_ttEmpRow" 
          xmlns:q4="urn:EmployeeSrvc:Employee"> 
      <Name xsi:type="xsd:string">Barney</Name> 
      <Number xsi:type="xsd:int">2</Number> 
    </q4:staticTT_ttEmpRow> 
  </soap:Body> 
</soap:Envelope> 

Note: The staticTT( ) method must send the object ID for the Employee AppObject in the SOAP request header because staticTT( ) is a method on the session-managed AppObject.

As a point of comparison, the following is a Document/Literal SOAP message that this call to staticTT( ) might send:

Document/Literal SOAP request to pass a TABLE parameter
<?xml version="1.0" encoding="utf-8" ?> 
  <soap:Envelope namespaces defined here...> 
    <soap:Header> 
      <EmployeeID xmlns="urn:EmployeeSrvc:Employee"> 
        <UUID>2e62cab6b81150d5:-1380e8e:f27fb934f4: 
        -8000;<Employee|PX-000004|AO>;5REiR9inxXQi4s6ghRWkfg==</UUID> 
      </EmployeeID> 
    </soap:Header> 
    <soap:Body> 
      <staticTT xmlns="urn:EmployeeSrvc:Employee"> 
        <ttEmp> 
          <ttEmpRow> 
            <Name>Fred</Name> 
            <Number>1</Number> 
          </ttEmpRow> 
          <ttEmpRow> 
            <Name>Barney</Name> 
            <Number>2</Number> 
          </ttEmpRow> 
        </ttEmp> 
      </staticTT> 
    </soap:Body> 
  </soap:Envelope> 

Note: The staticTT( ) method must send the object ID for the Employee AppObject in the SOAP request header because staticTT( ) is a method on the session-managed AppObject.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095